	<html>
	    <head>
		<script src="jquery-1.1.2.js" type="text/javascript"></script>
		<script src="jquery.flash.js" type="text/javascript"></script>
		<script type="text/javascript">
		    var token;
		    var sessiontoken;
		    function scriptreq(url) {
			var script = document.createElement('script');
			script.src = url;
			script.type = 'text/javascript';
			script.defer = true;
			var head = $('head').append(script);
		    }
		    $(function() {
			    sessiontoken = readCookie('sessiontoken');
			    if(sessiontoken != null && sessiontoken.length > 0) {
			       doFlash();
			    }
			    else {
				token = location.search;
				token = token.replace("?token=","");
				if(token === null || token.length == 0) {
				    window.location = "https://www.dopplr.com/api/AuthSubRequest?scope=http://www.dopplr.com&next="+window.location+"&session=1";
				    return;
				}
				$('#loading').show();
				scriptreq("https://www.dopplr.com/api/AuthSubSessionToken?token=" + token + "&callback=session&format=js");
			    }
		    });
		    function session(info) {
			sessiontoken = info['token'];
			createCookie('sessiontoken', sessiontoken, 7);
			doFlash();
		    }
		    function doFlash() {
			$('#loading').hide();
			$('#content').flash(
				{ src: 'citymap.swf',
			  width: 720,
			  height: 480,
			  flashvars: { token: sessiontoken } },
			{ version: "9.0.28.0" }
		);
            }

	    function createCookie(name,value,days) {
		if (days) {
		    var date = new Date();
		    date.setTime(date.getTime()+(days*24*60*60*1000));
		    var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	    }

	    function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
		    var c = ca[i];
		    while (c.charAt(0)==' ') c = c.substring(1,c.length);
		    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	    }

	    function eraseCookie(name) {
		createCookie(name,"",-1);
	    }
		</script>
    </head>
    <body>
        <div id='loading'>consulting api...</div>
        <div id='content'>
        </div>
    </body>
</html>
